from django import forms
from app.news.models import News
from app.form import FormMixin


# modelForm
class NewsPubForm(forms.ModelForm, FormMixin):
    tag_id = forms.IntegerField()

    class Meta:
        model = News
        fields = ['title', 'desc', 'content', 'thumbnail_url', 'tag_id']
        error_messages = {
            "title": {
                "required": "新闻标题不能为空",
            },
            "desc": {
                "required": "新闻描述不能为空",
            }
        }
